﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace LCRReader
{
    public partial class Main : Form
    {
        public Main()
        {
            InitializeComponent();
            Showchild(new Display());
            
           
        }
        private void Showchild(Form form)
        {
            Form _fm = null;
            var fs = MdiChildren.Where(t => t.Name == form.Name);
            if (fs != null && fs.Count() > 0)
            {
                var f = fs.First();
                _fm = f;
            }
            else
            {
                _fm = form;
            }
            _fm.MdiParent = this;
            _fm.FormBorderStyle = FormBorderStyle.None;
            _fm.Dock = DockStyle.Fill;     
            _fm.Show();
            _fm.BringToFront(); 
            foreach(var f in MdiChildren.Where(t=>t.Name!=form.Name))
            {
                f.Hide();
            }
        }

        private void 设置ToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            Showchild(new usrSet());
        }

        private void 设置ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Showchild(new Display());
        }

        private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {

        }
    }
}
